package com.logistics.role.entity.model;

import com.logistics.role.entity.domain.Role;
import com.logistics.utils.aspect.annotation.Dictionary;
import com.logistics.utils.tool.DateUtils;
import lombok.Data;

@Data
public class RoleRow {

    private Integer id;
    private String name;
    @Dictionary(key = "data_range")
    private String dataRange;
    private String menuIds;
    private String creator;
    private String createTime;
    private String updater;
    private String updateTime;



    public RoleRow(){

    }

    public RoleRow(Role role){
        this.id = role.getId();
        this.name = role.getName();
        this.dataRange = role.getDataRange();
        this.creator = role.getCreator();
        this.createTime = DateUtils.dateToStringFormat(role.getCreateTime(), DateUtils.YYYY_MM_DD_HH_MM_SS);
        this.updater = role.getUpdater();
        this.updateTime = DateUtils.dateToStringFormat(role.getUpdateTime(), DateUtils.YYYY_MM_DD_HH_MM_SS);
    }

    public static RoleRow build(Role role){
        return new RoleRow(role);
    }
}
